﻿
using IOCPExampleProtocol;
using PNet;
using System;

namespace ICOPServerExp
{
    internal class ServerStart
    {
        static void Main(string[] args)
        {
            IOCPNet<ServerToken, NetMsg> server = new IOCPNet<ServerToken, NetMsg>();
            server.StartAsServer("127.0.0.1", 17688,10000);
            while (true)
            {
                string str = Console.ReadLine();
                if (str == "quit")
                {
                    server.CloseServer();
                    break;
                }
                else 
                {
                    foreach (var token in server.GetAllTokens())
                    {
                        token.SendMsg(new NetMsg() { Msg = str });
                    }

                }
            }
            Console.ReadKey();
           
        }
    }
}
